package com.gxa.modules.service.impl;


import com.gxa.common.base.RespResult;
import com.gxa.common.util.TimeSlotUtil;
import com.gxa.modules.mapper.CustomerMapper;
import com.gxa.modules.service.CustomerService;
import org.apache.poi.ss.formula.functions.Today;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class CustomerServiceImpl implements CustomerService {

    @Autowired
    private CustomerMapper customerMapper;

    RespResult respResult=new RespResult();
    @Override
    public RespResult customerManagement() {

        List list = customerMapper.customerManagement();
        if (list !=null){
            respResult.setCode(200);
            respResult.setMessage("查询成功");
            respResult.setData(list);
        }else {
            respResult.setCode(500);
            respResult.setMessage("查询失败");
        }
        return respResult;
    }

    @Override
    public RespResult customerToday(){
        Date today = TimeSlotUtil.getTimesnight();
        List list = customerMapper.customerToday(today);
        if (list !=null){
            respResult.setCode(200);
            respResult.setMessage("查询成功");
            respResult.setData(list);
        }else {
            respResult.setCode(500);
            respResult.setMessage("查询失败");
        }
        return respResult;
    }
}
